<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page isELIgnored="false"%>

<%
	String path = request.getContextPath();
	String ctx = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=ctx%>">
		<link href="<%=ctx%>image/favicon.ico" rel="shortcut icon" />
		<title>呼送后台管理系统-首页</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
<link href='http://static.image.alimmdn.com/favicon.ico?t=123654' rel="shortcut icon" />
		<!-- 新 Bootstrap 核心 CSS 文件 -->
		<link rel='stylesheet'
			href='http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css'>
		
	</head>

	<body style="font-family: '微软雅黑'; background-image: url(image/main-back-image.jpg); 
				background-repeat:no-repeat; background-size: 100%;" >

		<div id="login-div">
			<form action='#' class='form-signin' style="width: 300px;">
				
				<input type='text' class='form-control' name="username" placeholder='请输入用户名'
					required autofocus>
				<div style='height: 10px; clear: both; display: block'></div>
				<input
					type='password'
					class='form-control' name="password" placeholder='请输入密码' required>
					
					
				<div style='height: 10px; clear: both; display: block'></div>
				
				<!-- <select name="opencityid" class='form-control' required>
					<option >请选择</option>
				</select> -->
					
				<div class='checkbox'>
					<label>
						
					</label>
				</div>
				<input type="button" class='btn btn-lg btn-primary btn-block' name="login_button" value="登录"/>
			</form>
		</div>
		<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
		<script src='http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js'></script>
		<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
		<script
			src='http://cdn.bootcss.com/bootstrap/3.2.0/js/bootstrap.min.js'></script>
		<script type="text/javascript">
			$(document).ready(function(){
				// 控制权限  城市  2015年7月10日10:21:44
				
				
				// 获取屏幕的px
				var x = document.body.clientWidth;
				var y = document.body.clientHeight;
				
				var height = $("#login-div").css("height");
				height = height.substring(0,height.indexOf("px"));
				
				$("#login-div").css("margin-top",y/2 );
				$("#login-div").css("margin-left",x/2 - 150);
				// login-div
				
				// 登录 2015年6月19日10:03:23
				$("input[name='login_button']").click(function(){
					var username = $("input[name='username']").val();
					var password = $("input[name='password']").val();
					// alert(username);
					if(username==null || username=='' || password==null || password==''){
						return;
					}
					// 使用ajax 登录 
					$.post("<%=ctx%>broker/broker/login",{username:username,password:password},function(data){
						var result = jQuery.parseJSON(data);
						if(result.DATA=='SUCCESS'){
							// 跳转下面的页面
							location.href = "<%=ctx%>main/stage/main";
						}
					});
					
				});
			});
		</script>
	</body>
</html>
